<script lang="tsx">
import { defineComponent } from 'vue'
import { useRouter } from 'vue-router'
import { Lottie } from '@/components/Lottie'

export default defineComponent({
  name: 'ErrorPage',
  components: {
    Lottie
  },
  setup() {
    const router = useRouter()

    function goHome() {
      router.push('/')
    }

    function goBack() {
      router.go(-1)
    }

    return () => {
      return (
        <div class="errPage">
          <div>
            <Lottie
              width="400px"
              height="300px"
              src="https://assets9.lottiefiles.com/packages/lf20_afwjhfb2.json"
            />
            <div class="info">抱歉，您访问的页面不存在。</div>
            <div class="goback">
              <el-button onClick={goBack}>返回上一页</el-button>
              <el-button type="primary" onClick={goHome}>
                返回首页
              </el-button>
            </div>
          </div>
        </div>
      )
    }
  }
})
</script>

<style lang="scss">
.errPage {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;

  .info {
    text-align: center;
    font-size: 16px;
    padding: 20px 0;
    color: #999;
  }

  .goback {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }
}
</style>
